home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / policykit-1.postinst < prev    next >
Encoding:
Text File  |  2012-01-29  |  1.7 KB  |  68 lines

  1. #!/bin/sh
  2. # postinst script for policykit-1
  3. #
  4. # see: dh_installdeb(1)
  5.  
  6. set -e
  7.  
  8. # summary of how this script can be called:
  9. #        * <postinst> `configure' <most-recently-configured-version>
  10. #        * <old-postinst> `abort-upgrade' <new version>
  11. #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  12. #          <new-version>
  13. #        * <postinst> `abort-remove'
  14. #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  15. #          <failed-install-package> <version> `removing'
  16. #          <conflicting-package> <version>
  17. # for details, see http://www.debian.org/doc/debian-policy/ or
  18. # the debian-policy package
  19.  
  20. set_perms() {
  21.     USER=$1
  22.     GROUP=$2
  23.     MODE=$3
  24.     FILE=$4
  25.     if ! dpkg-statoverride --list $FILE > /dev/null 2>&1; then
  26.         chown $USER:$GROUP $FILE
  27.         chmod $MODE $FILE
  28.     fi
  29. }
  30.  
  31. get_pid() {
  32.     [ -n "$1" ] || return
  33.     [ -S /var/run/dbus/system_bus_socket ] || return
  34.  
  35.     dbus-send --system --dest=org.freedesktop.DBus --print-reply \
  36.               /org/freedesktop/DBus org.freedesktop.DBus.GetConnectionUnixProcessID \
  37.               string:$1 2>/dev/null | awk '/uint32/ {print $2}'
  38. }
  39.  
  40. case "$1" in
  41.     configure)
  42.     set_perms root root 700 /var/lib/polkit-1
  43.     set_perms root root 4755 /usr/lib/policykit-1/polkit-agent-helper-1
  44.     set_perms root root 4755 /usr/bin/pkexec
  45.  
  46.     # Kill the old polkitd daemon on upgrade, to ensure that the new
  47.     # version will be used at the next occasion.
  48.     kill $(get_pid org.freedesktop.PolicyKit1) 2>/dev/null || true
  49.     ;;
  50.  
  51.     abort-upgrade|abort-remove|abort-deconfigure)
  52.     ;;
  53.  
  54.     *)
  55.         echo "postinst called with unknown argument \`$1'" >&2
  56.         exit 1
  57.     ;;
  58. esac
  59.  
  60. # dh_installdeb will replace this with shell code automatically
  61. # generated by other debhelper scripts.
  62.  
  63.  
  64.  
  65. exit 0
  66.  
  67.  
  68.